﻿@model IEnumerable<FastFood.Core.Models.OrderModel>

@{
    ViewBag.PageTitle = "Your orders";
}

<h2>Recent orders</h2>

<table>
    <tr>
        <th></th>
        <th>
            Id
        </th>
        <th>
            Restaurant
        </th>
        <th>
            Description
        </th>
        <th>
            Date ordered
        </th>
        <th>
            Status
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Details", "Details", new { id=item.Id })
        </td>
        <td>
            @item.Id
        </td>
        <td>
            <a href="@Url.Action("Details", "Restaurant", new{ name = item.DeliveryBoy.Restaurant.Name })" >@item.DeliveryBoy.Restaurant.Name</a>
        </td>
        <td>
            @item.Description
        </td>
        <td>
            @String.Format("{0:g}", item.DateOrdered)
        </td>
        <td>
            @item.Status.ToString()
        </td>
    </tr>
}

</table>

<h5>*Only orders requested during the last seven days are shown</h5>

<script>
    $(document).ready(function () {
        $("#orders").addClass("active");
    });
</script>
